{ inhibitEvents: true,
fadeInTime: STANDARD_FADE_TIME,
fadeFactor: 1 });
+
+ this.idleMonitor = new GnomeDesktop.IdleMonitor();
},
_onLockScreenKeyRelease: function(actor, event) {
},
_onStatusChanged: function(status) {
- if (status == GnomeSession.PresenceStatus.IDLE) {
- if (this._dialog) {
- this._dialog.cancel();
- if (!this._isGreeter) {
- this._dialog = null;
- }
- }
+ if (status != GnomeSession.PresenceStatus.IDLE)
+ return;
- if (!this._isModal) {
- Main.pushModal(this.actor);
- this._isModal = true;
+ if (this._dialog) {
+ this._dialog.cancel();
+ if (!this._isGreeter) {
+ this._dialog = null;
}
+ }
- if (!this._isActive) {
- this._lightbox.show();
+ if (!this._isModal) {
+ Main.pushModal(this.actor);
+ this._isModal = true;
+ }
- if (this._activationTime == 0)
- this._activationTime = GLib.get_monotonic_time();
- }
- } else {
- let lightboxWasShown = this._lightbox.shown;
- this._lightbox.hide();
+ if (!this._isActive) {
+ this._lightbox.show();
- let shouldLock = lightboxWasShown && this._settings.get_boolean(LOCK_ENABLED_KEY);
- if (shouldLock || this._isActive) {
- this.lock(false);
- } else if (this._isModal) {
- this.unlock();
- }
+ if (this._activationTime == 0)
+ this._activationTime = GLib.get_monotonic_time();
+
+ this._becameActiveId = this.idleMonitor.connect('became-active', Lang.bind(this, function() {
+ this.idleMonitor.disconnect(this._becameActiveId);
+
+ let lightboxWasShown = this._lightbox.shown;
+ this._lightbox.hide();
+
+ let shouldLock = lightboxWasShown && this._settings.get_boolean(LOCK_ENABLED_KEY);
+ if (shouldLock || this._isLocked) {
+ this.lock(false);
+ } else if (this._isActive) {
+ this.unlock();
+ }
+ }));
+
+ this._isActive = true;
+ this.emit('lock-status-changed');
}
},
this._activationTime = 0;
this._isActive = false;
+ this._isLocked = false;
this.emit('lock-status-changed');
},
this._resetLockScreen(animate, animate);
this._isActive = true;
+ this._isLocked = true;
this.emit('lock-status-changed');
},
});